<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="java.util.UUID"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>确认订单</title>
<link rel="shortcut icon" type="image/x-icon"
	href="assets/img/favicon.ico">

<!-- CSS 
    ========================= -->
<!--bootstrap min css-->
<link rel="stylesheet"
	href="https://www.jq22.com/jquery/bootstrap-4.2.1.css">
<!--owl carousel min css-->
<link rel="stylesheet" href="assets/css/owl.carousel.min.css">
<!--slick min css-->
<link rel="stylesheet" href="assets/css/slick.css">
<!--magnific popup min css-->
<link rel="stylesheet" href="assets/css/magnific-popup.css">
<!--font awesome css-->
<link rel="stylesheet"
	href="https://www.jq22.com/jquery/font-awesome.4.7.0.css">
<!--ionicons css-->
<link rel="stylesheet" href="assets/css/ionicons.min.css">
<!--linearicons css-->
<link rel="stylesheet" href="assets/css/linearicons.css">
<!--animate css-->
<link rel="stylesheet" href="assets/css/animate.css">
<!--jquery ui min css-->
<link rel="stylesheet" href="assets/css/jquery-ui.min.css">
<!--slinky menu css-->
<link rel="stylesheet" href="assets/css/slinky.menu.css">
<!--plugins css-->
<link rel="stylesheet" href="assets/css/plugins.css">

<!-- Main Style CSS -->
<link rel="stylesheet" href="assets/css/style.css">

<!--modernizr min js here-->
<script src="assets/js/vendor/modernizr-3.7.1.min.js"></script>

</head>
<body>

	<jsp:include page="head.jsp"></jsp:include>

	<!--breadcrumbs area start-->
	<div class="breadcrumbs_area">
		<div class="container">
			<div class="row">
				<div class="col-12">
					<div class="breadcrumb_content">
						<h3>确认订单</h3>
						<div ><%=request.getAttribute("msg")==null?"":request.getAttribute("msg") %></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--breadcrumbs area end-->

	<!--Checkout page section-->
	<div class="Checkout_section mt-70">
		<div class="container">
			<div class="row">
			
				<form action="OrdersServlet?op=add" method="post">
				<input type="hidden" name="op" value="add">
							<!-- 处理重复提交操作的一个 token 令牌，表单提交，令牌也提交 -->
							<%
							   //重复提交 I. 在session范围内产生一个token的值。
								session.setAttribute("token", System.nanoTime() + "");
							%>
							<!-- 重复提交 II 将token通过隐藏域传递给servlet -->
							<input type="hidden" name="token" value="${sessionScope.token}">
				<div class="checkout_form">
					<div class="row">
						<div class="col-lg-6 col-md-6">
						
							
								<h3>确认订单信息</h3>
								<div class="row">

									<div class="col-lg-6 mb-20">
										<label>联系人 <span>*</span></label> <input id="userid" name="userid" value="${users.username}" type="text" readonly="readonly">
									</div>
									<div class="col-lg-6 mb-20">
										<label>联系人电话 <span>*</span></label> <input id="usercall" name="usercall" value="${users.usercall}" type="text" readonly="readonly">
									</div>
									<div class="col-12 mb-20">
										<!-- 生成uuid编码作为订单编号 -->
										<% UUID uuid = UUID.randomUUID(); %>
										<label>订单编号</label> <input id="orderid" name="orderid" value="<%=uuid%>" type="text" readonly="readonly">
									</div>
									<div class="col-12 mb-20">
										<label for="country">支付方式 <span>*</span></label> <select
											class="select_option" name="cuntry" id="country">
											<option value="2">余额</option>
											<option value="3">支付宝</option>
											<option value="4">微信</option>
											<option value="5">银行卡</option>
										</select>
									</div>

									<div class="col-12 mb-20">
										<label>送货地址 <span>*</span></label> 
										<input id="address" name="address" value="${users.address}" type="text" readonly="readonly">
										<input id="orderstatus" name="orderstatus" type="hidden" type="text" value="1" readonly="readonly">
									</div>
										
									<div class="col-12 mb-20">
										<label>商家名称<span>*</span></label><input id="store" name="store" value="${store.store}" type="text" readonly="readonly">
										<label>商家电话<span>*</span></label><input id="storecall" name="storecall" value="${store.storecall}" type="text" readonly="readonly">
									</div>
									<div class="col-12">
										<div class="order-notes">
											<label for="order_note">备注</label>
											<textarea id="orderinfo" name="orderinfo" placeholder=""></textarea>
										</div>
									</div>
								</div>

						</div>
						<div class="col-lg-6 col-md-6">

								<h3>订单详情</h3>
								<div class="order_table table-responsive">
									<table>
										<thead>
											<tr>
												
												<th>菜品</th>
												<th>单价</th>
												<th>数量</th>
												<th>小计</th>
											</tr>
										</thead>
										<tbody>
										
											
											<c:if test="${cart!=null}">
											<c:forEach items="${cart.cartItems}" var="list" >
												<tr>
													<td><input id="foodsname${list.key}" name="foodsname" value="${list.value.foods.foodsname}" type="text" style="text-align:center;" readonly="readonly"></td>
													<td><input id="price${list.key}" name="price" value="${list.value.foods.price}" type="text" style="text-align:center;" readonly="readonly"></td>
													<td><input id="count${list.key}" name="count" value="${list.value.count}" type="text" style="text-align:center;" readonly="readonly"></td>
													<td><input id="subtotal${list.key}" name="subtotal" value="${list.value.total}" type="text" style="text-align:center;" readonly="readonly"></td>
												</tr>
											</c:forEach>
											</c:if>
										</tbody>
										<tfoot>
											<tr class="order_total">
												<th>订单总价</th>
												<td colspan="3"><input id="store" name="total" value="${cart.total}" type="text" style="text-align:center;" ></td>
												
											</tr>
										</tfoot>
									</table>
								</div>
								<div class="payment_method">
									<div class="order_button">
										<button type="submit">提交订单</button>
									</div>
								</div>
							
							
						</div>
					</div>
				</div>
				</form>
				
			</div>
		</div>
	</div>
		<!--Checkout page section end-->
		
		<!--控制距离 开始-->
		<div class="shipping_area">
			<div class="container">
				<div class="row">
					<div class="col-lg-3 col-md-6"></div>
					<div class="col-lg-3 col-md-6"></div>
					<div class="col-lg-3 col-md-6"></div>
					<div class="col-lg-3 col-md-6"></div>
				</div>
			</div>
		</div>
		<!--footer area start-->
		<jsp:include page="footer.jsp"></jsp:include>
		
	
	
</body>
</html>